home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994…tember: Reference Library / Dev.CD Sep 94.toast / Periodicals / develop / develop Issue 6 / develop 6 code / TCP / NewsWatcher / NewsWatcher 2.0d15 source / source / activate.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-07-17  |  1.9 KB  |  83 lines  |  [TEXT/KAHL]

  1. /*----------------------------------------------------------------------------
  2.  
  3.     activate.c
  4.  
  5.     This module handles window activate/deactivate events.
  6.     
  7.     Portions copyright © 1990, Apple Computer.
  8.     Portions copyright © 1993, Northwestern University.
  9.  
  10. ----------------------------------------------------------------------------*/
  11.  
  12. #include "glob.h"
  13. #include "activate.h"
  14. #include "util.h"
  15.  
  16.  
  17. /*    HandleActivate activates/deactivates windows */
  18.  
  19. void HandleActivate (WindowPtr wind, Boolean actFlag)
  20. {
  21.     TWindow **info;
  22.     GrafPtr savePort;
  23.     Rect growBoxRect;
  24.     short fontNum;
  25.     ControlHandle theControl;
  26.     
  27.     if (IsAppWindow(wind)) {
  28.         info = (TWindow**)GetWRefCon(wind);
  29.         switch ((**info).kind) {
  30.             case kFullGroup:
  31.             case kNewGroup:
  32.             case kUserGroup:
  33.             case kSubject:
  34.                 LActivate(actFlag,(**info).theList);
  35.                 break;
  36.             case kArticle:
  37.             case kMiscArticle:
  38.             case kPostMessage:
  39.             case kMailMessage:
  40.                 theControl = ((WindowPeek) wind)->controlList;
  41.                 if (actFlag) {
  42.                     ShowControl(theControl);
  43.                     theControl = (**theControl).nextControl;
  44.                     if (theControl != nil) ShowControl(theControl);
  45.                     TEActivate((**info).theTE);
  46.                 }
  47.                 else {
  48.                     HideControl(theControl);
  49.                     theControl = (**theControl).nextControl;
  50.                     if (theControl != nil) HideControl(theControl);
  51.                     TEDeactivate((**info).theTE);
  52.                 }
  53.                 break;
  54.             case kStatus:
  55.                 break;
  56.         }
  57.         GetPort(&savePort);
  58.         SetPort(wind);
  59.         SetRect(&growBoxRect,wind->portRect.right-15,wind->portRect.top,
  60.             wind->portRect.right,wind->portRect.bottom);
  61.         InvalRect(&growBoxRect);
  62.         SetPort(savePort);
  63.         ShowCursor();
  64.     }
  65. }
  66.  
  67.  
  68. /* HandleSuspendResume: Handles suspend/resume events- activates main window */
  69.  
  70. void HandleSuspendResume (long message)
  71. {
  72.     SetCursor(&qd.arrow);
  73.     if ((message >> 24) == 1) {
  74.         if ((message & 1) != 0) {
  75.             gInBackground = false;
  76.             HandleActivate(FrontWindow(),true);
  77.         } else {
  78.             gInBackground = true;
  79.             HandleActivate(FrontWindow(),false);
  80.         }
  81.     }
  82. }
  83.